<template>
  <el-cascader
    v-model="value1"
    :disabled="!self.obj.name"
    :style="{width:width,}"
    :placeholder="placeholder"
    :props="{multiple:multiple}"
    :options="data"
    @change="change"
    filterable
  ></el-cascader>
</template>
<script>
export default {
  name: "Cascader",
  watch: {
    value(newValue) {
      this.self.obj.value = newValue;
      this.value1 = newValue;
    }
  },
  data() {
    return {
      value1:[]
    }
  },
  props: {
    data: {
      type: Array,
      default() {
        return [];
      }
    },
    value: {
      type: Array,
      default() {
        return [];
      }
    },
    width: {
      type: String,
      default: "300px"
    },
    placeholder: {
      type: String,
      default: ""
    },
    multiple: {
      type: Boolean,
      default: false
    },
    self: {
      type: Object,
      default() {
        return {};
      }
    }
  },
  methods: {
    change(value) {
      if (!this.self.obj.name) {
        return false;
      }
      console.log(this.self.obj,'obj')
      this.self.obj.value = value;
    }
  }
};
</script>
<style lang="scss" scoped>
</style>
